import Encrypt from 'encryptlong' // 是基于 jseEncrypt 扩展的长文本分段加解密功能。

// 密钥对生成 http://web.chacuo.net/netrsakeypair
// 公钥key
const publicKey: string = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCxkIbCWY8re71Fwmf4ehTl+6xuvFSbEuE7ZumXMlOkvWdSVatiTNnrX29I33uAicp19XJAwZSy2hKUPkoSmqzyZ9Si+fi3h1ZGD31WtSVxiAGgkmclVjIiuph2v8kjc/knzZgzLQaPX5E5SkFKPK+9bWJ+2Fkrx3ulSBxAeqWTuQIDAQAB'
// 私钥key
const privateKey: string = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALGQhsJZjyt7vUXCZ/h6FOX7rG68VJsS4Ttm6ZcyU6S9Z1JVq2JM2etfb0jfe4CJynX1ckDBlLLaEpQ+ShKarPJn1KL5+LeHVkYPfVa1JXGIAaCSZyVWMiK6mHa/ySNz+SfNmDMtBo9fkTlKQUo8r71tYn7YWSvHe6VIHEB6pZO5AgMBAAECgYBJuOHai2if+y4oaoDUb4uBuS5sg5D1Ga+eBCpz9hc4TNM7IgqYM6Q+z07bCL60LYF73D5lmHnukBAqsHn8o2+uPBl202/Mg9j3VGD3BVfcjXOeNmtbdGRbK8qR/AG33WoUC41DqXG5teXQ1bqbzgIhd/o8c3beLGkS6kNjhOXCiQJBAOCcgRgeRSetiZMFCBzXEqds0Zk7rOUyjFGUA6ANsHZQbiZYYqXWuvetbLcjdYmSW5H92+FsVZDSIq7kGQzk9y8CQQDKYOsF+a7MEQaSyJ84olmiRyL9OCxBW0Qkgi81mZSbAQ4zKEN42rYYhpzEFSRYNltYbqlr5UaheOnGtw4nwumXAkEApHWziGdRl3XXT9DVWdiYjgJ9jcdGFyPl3i2UYfLkDB1kKat5v5f0mjlfatEJ1MtXRRQtlWbvV/Sk9I2LUgesfQJAft4a93f6uDrEIChciChegHiP2qXoOGB6a1ihN7y7iCA1QqSvB4g0N1PL2rBWRGZvBRT6aIUmrfsaslP3L73kqQJBAJ0GwkZTKLEMTzObpKWooYP/UE8kdTf6FMrL0BJohZ1DMQ33hdLr+qO9MM4wU9HtI+MjBKzOg4FvQwe1TlNLH/Q=";


/* 加密 */
export function jseEncryptLong(data: string) {
    const encryptor = new Encrypt()
    encryptor.setPublicKey(publicKey)
    return encryptor.encrypt(data)
}

/* 解密 - PRIVATE_KEY - 验证 */
export function jseDecryptLong(data: string) {
    const encryptor = new Encrypt()
    encryptor.setPrivateKey(privateKey)
    return encryptor.decrypt(data)
}

